package com.tct.ndocgen.util;


import com.tct.ndocgen.entity.Rs;
import com.tct.ndocgen.entity.enums.RsEnum;

/**
 * @description: 返回结果工具类
 * @author: 胡海龙
 * @create: 2021-08-07 00:10:26
 **/
public class RsUtil {

    public static Rs success(String message){
        return Rs.builder().code(RsEnum.SUCCESS.code()).status(true).message(message).build();
    }

    public static Rs success(String message, Object data){
        return Rs.builder().code(RsEnum.SUCCESS.code()).status(true).message(message).data(data).build();
    }

    public static Rs error(RsEnum rsEnum, String message){
        return Rs.builder().code(rsEnum.code()).status(false).message(message).build();
    }

    public static Rs error(RsEnum rsEnum, String message, Object data){
        return Rs.builder().code(rsEnum.code()).status(false).message(message).data(data).build();
    }
}
